<template>
	<view class="content">
		<!--产品，供应商列表 -->
		<purchaseTow ref="purchaseTow" 
			@setGoodsThree="setGoodsThree" 
			@setSuppmInfo="setSuppmInfo" 
			@scanGunSelectGds="scanGunSelectGds"
			@addNewGoods="addNewGoods"></purchaseTow>
		
		<!-- 开单页面 -->
		<purchaseThree ref="purchaseInfo" 
			@addSupp="addSupp" 
			@selectSuppBillGoods="selectSuppBillGoods"
			@editCart="editCart"
			@checkOut="checkOut"
			@setGdCustomIdNull="setGdCustomIdNull">
		</purchaseThree>
	</view>
</template>

<script>
	import purchaseTow from '../../components/purchase/PurchaseTow.vue';
	
	import purchaseThree from '../../components/purchase/PurchaseThree.vue';
		
	import lang from "../../js/conf/Lang.js";
	import staticConst from '../../js/const/StaticConst.js';
	
	import goodsAdd from "../../components/goods/GoodsAdd.vue";
	
	import eventCtrl from "../../js/event/EventCtrl.js";
	import goodsCtrl from "../../js/gd/GoodsCtrl.js";
	
	export default {
		components: { 
			purchaseTow, purchaseThree},
		data() {
			return {
				curPage:staticConst.CG_KD,
				actType:0 ,// 0:新增产品 1：编辑产品
				isNotData :false, // 没有数据
			}
		},
		
		onLoad() {
		},
		
		onShow() {
		},
		
		onHide() {
		},
		
		onUnload() {
		},
		
		onReady() {
			this.$refs.purchaseTow.initData();
			this.$refs.purchaseInfo.initData();
		},
				
		methods: {
			/***点击产品列表处理**/
			setGoodsThree(data)
			{
				this.$refs.purchaseInfo.addGoodsReceipt(data);
			},
			
			/****设置开单用户*******/
			setSuppmInfo(data,isCheckOut)
			{
				this.$refs.purchaseInfo.getSuppInfo(data,isCheckOut);
			},
			
			/***切换客户***/
			addSupp()
			{
				this.$refs.purchaseTow.selectedSuppGoodsList(2);
			},
			
			/***切换产品列表*****/
			selectSuppBillGoods()
			{
				this.$refs.purchaseTow.selectedSuppGoodsList(1);
			},
			
			/****编辑购物车***/
			editCart()
			{
				this.$refs.purchaseTow.setGoodIdIsNull();
			},
			
			/****check out 结算****/
			checkOut(value)
			{
				this.$refs.purchaseTow.checkOut(value);
			},
			
			/****放弃开单，开单成功****/
			setGdSuppIdNull()
			{
				this.$refs.purchaseTow.setGdSuppIdNull();
			},
			
			/*****扫码枪搜产品选中******/
			scanGunSelectGds(gdInfo)
			{
				this.$refs.purchaseInfo.scanGunSelectGds(gdInfo);
			},
			
			/****扫码找不到产品，就添加产品****/
			addNewGoods()
			{
				// this.$refs.changeTab.goods();
			},
		},
	}
</script>
<style lang="scss">
	.content
	{
		display: flex;
		justify-content: flex-start;
		min-width: 820px;
		height: 100%;
		position: relative;
	}
	
</style>